﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
 
using System.Text;
using System.Windows.Forms;
using FarPoint.Win.Spread.CellType;
using FarPoint.Win;

namespace Demo
{
    public partial class CellType : DemoBaseUserControl
    {
        public CellType()
        {
            InitializeComponent();
            this.Title = "单元格类型";
            this.Description = "Spread .NET  提供21种单元格类型，本例中展示了其中19种单元格类型，每个单元格类型展示了两种不同的定制方式。";
        }

        private void CellType_Load(object sender, EventArgs e)
        {
            proTimer.Start();
            fpSpread1_Sheet1.RowCount = 20;
            fpSpread1_Sheet1.Columns[0].VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Center;
            fpSpread1_Sheet1.Columns[0].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
            fpSpread1_Sheet1.Columns[0].Width = fpSpread1_Sheet1.Columns[0].GetPreferredWidth();
            this.fpSpread1_Sheet1.Columns.Get(0).Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular);
            this.fpSpread1_Sheet1.ColumnHeader.Rows.Get(0).Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold);
            
            fpSpread1_Sheet1.ColumnHeader.Cells[0, 1].ColumnSpan = 2;
            fpSpread1_Sheet1.ColumnHeader.Columns[0].Label = "单元格类型";
            fpSpread1_Sheet1.ColumnHeader.Columns[1].Label = "示例";

            #region Int
            FarPoint.Win.Spread.CellType.NumberCellType numberCellType1 = new FarPoint.Win.Spread.CellType.NumberCellType();
            FarPoint.Win.Spread.CellType.NumberCellType numberCellType2 = new FarPoint.Win.Spread.CellType.NumberCellType();
            FarPoint.Win.Spread.CellType.TextCellType textCellType1 = new FarPoint.Win.Spread.CellType.TextCellType();
            this.fpSpread1_Sheet1.Cells.Get(0, 0).CellType = textCellType1;
            this.fpSpread1_Sheet1.Cells.Get(0, 0).Value = "整数型";
            this.fpSpread1_Sheet1.Cells.Get(0, 1).CellType = numberCellType1;
            numberCellType1.DecimalPlaces = 0;
            this.fpSpread1_Sheet1.Cells.Get(0, 1).Value = 235;
            numberCellType2.DropDownButton = true;
            numberCellType2.DecimalPlaces = 0;
            numberCellType2.NegativeRed = true;
            this.fpSpread1_Sheet1.Cells.Get(0, 2).CellType = numberCellType2;
            this.fpSpread1_Sheet1.Cells.Get(0, 2).Value = -235;
            #endregion

            #region Float
            FarPoint.Win.Spread.CellType.NumberCellType numberCellType4 = new FarPoint.Win.Spread.CellType.NumberCellType();
            FarPoint.Win.Spread.CellType.NumberCellType numberCellType5 = new FarPoint.Win.Spread.CellType.NumberCellType();
            FarPoint.Win.Spread.CellType.TextCellType textCellType2 = new FarPoint.Win.Spread.CellType.TextCellType();
            this.fpSpread1_Sheet1.Cells.Get(1, 0).CellType = textCellType2;
            this.fpSpread1_Sheet1.Cells.Get(1, 0).Value = "浮点型";
            this.fpSpread1_Sheet1.Cells.Get(1, 1).CellType = numberCellType4;
            this.fpSpread1_Sheet1.Cells.Get(1, 1).Value = 2.35;
            numberCellType5.ShowSeparator = true;
            numberCellType5.SpinButton = true;
            numberCellType5.NegativeRed = true;
            this.fpSpread1_Sheet1.Cells.Get(1, 2).CellType = numberCellType5;
            this.fpSpread1_Sheet1.Cells.Get(1, 2).Value = -2.3568;
            #endregion

            #region percent
            FarPoint.Win.Spread.CellType.PercentCellType percentCellType1 = new FarPoint.Win.Spread.CellType.PercentCellType();
            FarPoint.Win.Spread.CellType.PercentCellType percentCellType2 = new FarPoint.Win.Spread.CellType.PercentCellType();
            FarPoint.Win.Spread.CellType.TextCellType textCellType3 = new FarPoint.Win.Spread.CellType.TextCellType();
            this.fpSpread1_Sheet1.Cells.Get(2, 0).CellType = textCellType3;
            this.fpSpread1_Sheet1.Cells.Get(2, 0).Value = "百分数";
            this.fpSpread1_Sheet1.Cells.Get(2, 1).CellType = percentCellType1;
            this.fpSpread1_Sheet1.Cells.Get(2, 1).Value = 2.35;
            percentCellType2.NegativeRed = true;
            percentCellType2.SpinButton = true;
            percentCellType2.SpinDecimalIncrement = 10;
            percentCellType2.SpinIntegerIncrement = 5;
            this.fpSpread1_Sheet1.Cells.Get(2, 2).CellType = percentCellType2;
            this.fpSpread1_Sheet1.Cells.Get(2, 2).Value = -2.3556;
            #endregion

            #region Currency
            FarPoint.Win.Spread.CellType.CurrencyCellType currencyCellType1 = new FarPoint.Win.Spread.CellType.CurrencyCellType();
            FarPoint.Win.Spread.CellType.CurrencyCellType currencyCellType2 = new FarPoint.Win.Spread.CellType.CurrencyCellType();
            FarPoint.Win.Spread.CellType.TextCellType textCellType4 = new FarPoint.Win.Spread.CellType.TextCellType();
            this.fpSpread1_Sheet1.Cells.Get(3, 0).CellType = textCellType4;
            this.fpSpread1_Sheet1.Cells.Get(3, 0).Value = "货币格式";
            currencyCellType1.CurrencySymbol = "￥";
            this.fpSpread1_Sheet1.Cells.Get(3, 1).CellType = currencyCellType1;
            this.fpSpread1_Sheet1.Cells.Get(3, 1).Value = "235";
            currencyCellType2.CurrencySymbol = "$";
            currencyCellType2.SpinButton = true;
            currencyCellType2.NegativeRed = true;
            this.fpSpread1_Sheet1.Cells.Get(3, 2).CellType = currencyCellType2;
            this.fpSpread1_Sheet1.Cells.Get(3, 2).Value = "-235";
            #endregion

            #region DateTimeCellType

            FarPoint.Win.Spread.CellType.DateTimeCellType dateTimeType1 = new DateTimeCellType();
            FarPoint.Win.Spread.CellType.DateTimeCellType dateTimeType2 = new DateTimeCellType();
            FarPoint.Win.Spread.CellType.TextCellType textCellType5 = new FarPoint.Win.Spread.CellType.TextCellType();

            this.fpSpread1_Sheet1.Cells.Get(4, 0).CellType = textCellType5;
            this.fpSpread1_Sheet1.Cells.Get(4, 0).Value = "日期格式";
            this.fpSpread1_Sheet1.Cells.Get(4, 1).CellType = dateTimeType1;
            this.fpSpread1_Sheet1.Cells.Get(4, 1).Value = new System.DateTime(2007, 11, 15, 0, 0, 0, 0);

            dateTimeType2.CalendarSurroundingDaysColor = System.Drawing.SystemColors.GrayText;
            dateTimeType2.DateDefault = new System.DateTime(2007, 11, 6, 16, 26, 45, 734);
            dateTimeType2.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.UserDefined;
            dateTimeType2.TimeDefault = new System.DateTime(2007, 11, 6, 16, 26, 45, 734);
            dateTimeType2.UserDefinedFormat = "MMMM dd yyyy";
            dateTimeType2.DropDownButton = true;
            this.fpSpread1_Sheet1.Cells.Get(4, 2).CellType = dateTimeType2;
            this.fpSpread1_Sheet1.Cells.Get(4, 2).Value = new System.DateTime(2007, 11, 15, 0, 0, 0, 0);
            

            #endregion

            #region TextCellType
            FarPoint.Win.Spread.CellType.TextCellType textCellType6 = new FarPoint.Win.Spread.CellType.TextCellType();
            FarPoint.Win.Spread.CellType.TextCellType textCellType7 = new FarPoint.Win.Spread.CellType.TextCellType();
            FarPoint.Win.Spread.CellType.TextCellType textCellType8 = new FarPoint.Win.Spread.CellType.TextCellType();
            this.fpSpread1_Sheet1.Cells.Get(5, 0).CellType = textCellType6;
            this.fpSpread1_Sheet1.Cells.Get(5, 0).Value ="文本格式";
            this.fpSpread1_Sheet1.Cells.Get(5, 1).CellType = textCellType7;
            this.fpSpread1_Sheet1.Cells.Get(5, 1).Value = "文本型单元格类型";
            this.fpSpread1_Sheet1.Cells.Get(5, 2).CellType = textCellType8;
            this.fpSpread1_Sheet1.Cells.Get(5, 2).Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline| FontStyle.Italic| FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.fpSpread1_Sheet1.Cells.Get(5, 2).Value = "文本型单元格类型";
            #endregion

            #region ButtonCellType
            FarPoint.Win.Spread.CellType.ButtonCellType buttonCellType1 = new FarPoint.Win.Spread.CellType.ButtonCellType();
            FarPoint.Win.Spread.CellType.ButtonCellType buttonCellType2 = new FarPoint.Win.Spread.CellType.ButtonCellType();
            FarPoint.Win.Spread.CellType.TextCellType textCellType9 = new FarPoint.Win.Spread.CellType.TextCellType();
            //this.fpSpread1_Sheet1.
            this.fpSpread1_Sheet1.Cells.Get(6, 0).CellType = textCellType9;
            this.fpSpread1_Sheet1.Cells.Get(6, 0).Value = "按钮型";
            buttonCellType1.ButtonColor2 = System.Drawing.SystemColors.ButtonFace;
            buttonCellType1.Text = "单击我";
            buttonCellType1.TextDown = "Clicked!";
            this.fpSpread1_Sheet1.Cells.Get(6, 1).CellType = buttonCellType1;
            buttonCellType2.ButtonColor2 = System.Drawing.SystemColors.ButtonFace;
            buttonCellType2.Text = "弹起状态";
            buttonCellType2.TextDown = "按下状态";
            buttonCellType2.TwoState = true;
            this.fpSpread1_Sheet1.Cells.Get(6, 2).CellType = buttonCellType2;
            this.fpSpread1_Sheet1.Cells.Get(6, 2).Value = 0;
            #endregion

            #region CheckBoxCellType
            FarPoint.Win.Spread.CellType.CheckBoxCellType checkBoxCellType1 = new FarPoint.Win.Spread.CellType.CheckBoxCellType();
            FarPoint.Win.Spread.CellType.CheckBoxCellType checkBoxCellType2 = new FarPoint.Win.Spread.CellType.CheckBoxCellType();
            FarPoint.Win.Spread.CellType.TextCellType textCellType10 = new FarPoint.Win.Spread.CellType.TextCellType();
            this.fpSpread1_Sheet1.Cells.Get(7, 0).CellType = textCellType10;
            this.fpSpread1_Sheet1.Cells.Get(7, 0).Value = "复选框型";
            checkBoxCellType1.TextFalse = "勾选这里";
            checkBoxCellType1.TextTrue = "已勾选!";
            this.fpSpread1_Sheet1.Cells.Get(7, 1).CellType = checkBoxCellType1;

            checkBoxCellType2.Caption = "3 态!";
            checkBoxCellType2.ThreeState = true;
            this.fpSpread1_Sheet1.Cells.Get(7, 2).Font = new System.Drawing.Font("Palatino Linotype", 8.25F, System.Drawing.FontStyle.Bold);
            this.fpSpread1_Sheet1.Cells.Get(7, 2).BackColor = System.Drawing.Color.Cyan;
            //this.fpSpread1_Sheet1.Cells.Get(7, 2).Border =  ;
            this.fpSpread1_Sheet1.Cells.Get(7, 2).CellType = checkBoxCellType2;
            this.fpSpread1_Sheet1.Cells.Get(7, 2).HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
            this.fpSpread1_Sheet1.Cells.Get(7, 2).VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Center;
            this.fpSpread1_Sheet1.Cells.Get(7, 2).Value = 1;
            #endregion

            #region ComboBoxCellType
            FarPoint.Win.Spread.CellType.ComboBoxCellType comboBoxCellType1 = new FarPoint.Win.Spread.CellType.ComboBoxCellType();
            FarPoint.Win.Spread.CellType.ComboBoxCellType comboBoxCellType2 = new FarPoint.Win.Spread.CellType.ComboBoxCellType();
            FarPoint.Win.Spread.CellType.TextCellType textCellType11 = new FarPoint.Win.Spread.CellType.TextCellType();
            this.fpSpread1_Sheet1.Cells.Get(8, 0).CellType = textCellType10;
            this.fpSpread1_Sheet1.Cells.Get(8, 0).Value = "组合框型";
            comboBoxCellType1.ButtonAlign = FarPoint.Win.ButtonAlign.Right;
            comboBoxCellType1.Items = new string[] {
        "Apples",
        "Oranges",
        "Grapes"};
            this.fpSpread1_Sheet1.Cells.Get(8, 1).CellType = comboBoxCellType1;
            this.fpSpread1_Sheet1.Cells.Get(8, 1).Value = "";

            comboBoxCellType2.Items = new string[] { "English", "History", "Math", "Music", "Science" };
            ImageList ilist = new ImageList();
            string defaultCommonPath = System.IO.Path.Combine(Application.StartupPath, "..\\..\\Resources\\");// default XML path
            string commonPath1 = defaultCommonPath;
            string commonPath2 = defaultCommonPath;
            string commonPath3 = defaultCommonPath;
            Microsoft.Win32.RegistryKey commonKey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey("FarPoint.Win.Spread\\Resources");
            if (commonKey != null)
            {
                object commonPathObj = commonKey.GetValue("v52005", defaultCommonPath);
                commonPath1 = commonPathObj is string ? (string)commonPathObj : defaultCommonPath;
            }


            //string img1 = global::Demo.Properties.Resources.english;


            //System.IO.Stream image = this.GetType().Assembly.GetManifestResourceStream("SpreadWinDemo.english.gif");
            Image english = global::Demo.Properties.Resources.english;
            //image = this.GetType().Assembly.GetManifestResourceStream("SpreadWinDemo.history.gif");
            Image history = global::Demo.Properties.Resources.history;
            //image = this.GetType().Assembly.GetManifestResourceStream("SpreadWinDemo.math.gif");
            Image math = global::Demo.Properties.Resources.math;
            //image = this.GetType().Assembly.GetManifestResourceStream("SpreadWinDemo.music.gif");
            Image music = global::Demo.Properties.Resources.music;
            //image = this.GetType().Assembly.GetManifestResourceStream("SpreadWinDemo.science.gif");
            Image science = global::Demo.Properties.Resources.science;
            ilist.Images.Add(english);
            ilist.Images.Add(history);
            ilist.Images.Add(math);
            ilist.Images.Add(music);
            ilist.Images.Add(science);
            comboBoxCellType2.ImageList = ilist;

            this.fpSpread1_Sheet1.Cells.Get(8, 2).CellType = comboBoxCellType2;
            #endregion

            #region ListBoxCellType
            FarPoint.Win.LineBorder lineBorder1 = new FarPoint.Win.LineBorder(System.Drawing.SystemColors.WindowFrame);
            FarPoint.Win.Spread.CellType.ListBoxCellType listBoxCellType1 = new FarPoint.Win.Spread.CellType.ListBoxCellType();
            FarPoint.Win.LineBorder lineBorder2 = new FarPoint.Win.LineBorder(System.Drawing.SystemColors.WindowFrame);
            FarPoint.Win.Spread.CellType.ListBoxCellType listBoxCellType2 = new FarPoint.Win.Spread.CellType.ListBoxCellType();
            FarPoint.Win.Spread.CellType.TextCellType textCellType12 = new FarPoint.Win.Spread.CellType.TextCellType();
            this.fpSpread1_Sheet1.Cells.Get(9, 0).CellType = textCellType12;
            this.fpSpread1_Sheet1.Cells.Get(9, 0).Value = "列表框";
            this.fpSpread1_Sheet1.Cells.Get(9, 1).BackColor = System.Drawing.Color.BlanchedAlmond;
            this.fpSpread1_Sheet1.Cells.Get(9, 1).Border = lineBorder1;

            listBoxCellType1.Items = new string[] {
        "红",
        "黄",
        "绿",
        "蓝"};
            this.fpSpread1_Sheet1.Cells.Get(9, 1).CellType = listBoxCellType1;
            this.fpSpread1_Sheet1.Cells.Get(9, 1).Value = 0;

            this.fpSpread1_Sheet1.Cells.Get(9, 2).BackColor = System.Drawing.Color.BlanchedAlmond;
            this.fpSpread1_Sheet1.Cells.Get(9, 2).Border = lineBorder2;
            listBoxCellType2.EditorValue = FarPoint.Win.Spread.CellType.EditorValue.ItemData;

            listBoxCellType2.Items = new string[] {
        "红",
        "黄",
        "绿",
        "蓝"};
            listBoxCellType2.SelectionMode = SelectionMode.MultiSimple;
            this.fpSpread1_Sheet1.Cells.Get(9, 2).CellType = listBoxCellType2;
            this.fpSpread1_Sheet1.Cells.Get(9, 2).Value = "apple";

            this.fpSpread1_Sheet1.Rows.Get(9).Height = 70F;
            #endregion

            #region HyperLinkCellType
            FarPoint.Win.Spread.CellType.HyperLinkCellType hyperLinkCellType1 = new FarPoint.Win.Spread.CellType.HyperLinkCellType();
            FarPoint.Win.Spread.CellType.HyperLinkCellType hyperLinkCellType2 = new FarPoint.Win.Spread.CellType.HyperLinkCellType();
            FarPoint.Win.Spread.CellType.TextCellType textCellType13 = new FarPoint.Win.Spread.CellType.TextCellType();
            this.fpSpread1_Sheet1.Cells.Get(10, 0).CellType = textCellType13;
            this.fpSpread1_Sheet1.Cells.Get(10, 0).Value = "超链接型";
            hyperLinkCellType1.Link = "www.gcpowertools.com.cn";
            hyperLinkCellType1.LinkToolTips = new string[] { "这个链接将帮助您访问:GrapeCity PowerTools 网站" };
            hyperLinkCellType1.LinkArea = new System.Windows.Forms.LinkArea(0, 17);
            hyperLinkCellType1.LinkAreas = new System.Windows.Forms.LinkArea[] {
        new System.Windows.Forms.LinkArea(0, 23)};
            hyperLinkCellType1.Links = new string[] {
        "www.gcpowertools.com.cn"};
            hyperLinkCellType1.Text = "GrapeCity PowerTools 网站";
            this.fpSpread1_Sheet1.Cells.Get(10, 1).HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
            this.fpSpread1_Sheet1.Cells.Get(10, 1).VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Center;

            this.fpSpread1_Sheet1.Cells.Get(10, 1).CellType = hyperLinkCellType1;
            this.fpSpread1_Sheet1.Cells.Get(10, 1).Value = new bool[] {
        true};

            hyperLinkCellType2.BackgroundImage = new FarPoint.Win.Picture(global::Demo.Properties.Resources.Spread300, FarPoint.Win.RenderStyle.StretchAndScale, Color.Empty, FarPoint.Win.HorizontalAlignment.Center, FarPoint.Win.VerticalAlignment.Center);
            hyperLinkCellType2.Link = "www.gcpowertools.com.cn";
            hyperLinkCellType2.LinkToolTips = new string[] { "这个链接将帮助您访问:GrapeCity PowerTools 网站" };
            this.fpSpread1_Sheet1.Rows.Get(10).Height = 70F;
            this.fpSpread1_Sheet1.Cells.Get(10, 2).CellType = hyperLinkCellType2;
            this.fpSpread1_Sheet1.Cells.Get(10, 2).Border = lineBorder1;

            #endregion

            #region RadioBoxCellType
            FarPoint.Win.Spread.CellType.MultiOptionCellType multiOptionCellType1 = new FarPoint.Win.Spread.CellType.MultiOptionCellType();
            FarPoint.Win.Spread.CellType.MultiOptionCellType multiOptionCellType2 = new FarPoint.Win.Spread.CellType.MultiOptionCellType();
            FarPoint.Win.Spread.CellType.TextCellType textCellType14 = new FarPoint.Win.Spread.CellType.TextCellType();
            this.fpSpread1_Sheet1.Cells.Get(11, 0).CellType = textCellType13;
            this.fpSpread1_Sheet1.Cells.Get(11, 0).Value = "单选型";
            multiOptionCellType1.Items = new string[] {
        "选项 &A",
        "选项 &B",
        "选项 &C"};
            multiOptionCellType1.UseMnemonic = true;
            this.fpSpread1_Sheet1.Cells.Get(11, 1).CellType = multiOptionCellType1;
            this.fpSpread1_Sheet1.Cells.Get(11, 1).Value = -1;
            this.fpSpread1_Sheet1.Cells.Get(11, 1).Border = lineBorder1;
            this.fpSpread1_Sheet1.Cells.Get(11, 1).BackColor = Color.Aqua;

            multiOptionCellType2.Items = new string[] {
        "男",
        "女"};
            multiOptionCellType2.Orientation = FarPoint.Win.RadioOrientation.Horizontal;
            multiOptionCellType2.TextAlign = FarPoint.Win.ButtonTextAlign.TextBottomPictTop;
            this.fpSpread1_Sheet1.Cells.Get(11, 2).CellType = multiOptionCellType2;
            this.fpSpread1_Sheet1.Cells.Get(11, 2).Border = lineBorder1;
            this.fpSpread1_Sheet1.Cells.Get(11, 2).BackColor = Color.BlanchedAlmond;
            this.fpSpread1_Sheet1.Cells.Get(11, 2).HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
            this.fpSpread1_Sheet1.Cells.Get(11, 2).VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Center;

            this.fpSpread1_Sheet1.Columns.Get(1).Width = 76F;
            this.fpSpread1_Sheet1.Rows.Get(11).Height = 67F;

            #endregion

            #region BarCodeCellType
            System.Globalization.CultureInfo cultureInfo = new System.Globalization.CultureInfo("en-US", false);
            FarPoint.Win.Spread.CellType.BarCodeCellType barCodeCellType1 = new FarPoint.Win.Spread.CellType.BarCodeCellType();
            FarPoint.Win.Spread.CellType.BarCodeCellType barCodeCellType2 = new FarPoint.Win.Spread.CellType.BarCodeCellType();
            FarPoint.Win.Spread.CellType.TextCellType textCellType15 = new FarPoint.Win.Spread.CellType.TextCellType();
            this.fpSpread1_Sheet1.Cells.Get(12, 0).CellType = textCellType15;
            this.fpSpread1_Sheet1.Cells.Get(12, 0).Value = "条形码型";
            barCodeCellType1.BarCodePadding = new FarPoint.Win.Spread.CellType.BarCode.Quiet("", "");
            barCodeCellType1.BarSize = new FarPoint.Win.Spread.CellType.BarCode.BarSize("30.691mm", "17.197mm");
            barCodeCellType1.Type = new FarPoint.Win.Spread.CellType.BarCode.Code39("");
            this.fpSpread1_Sheet1.Cells.Get(12, 1).CellType = barCodeCellType1;
            this.fpSpread1_Sheet1.Cells.Get(12, 1).Value = "12345";

            barCodeCellType2.BarCodePadding = new FarPoint.Win.Spread.CellType.BarCode.Quiet("", "");
            barCodeCellType2.BarSize = new FarPoint.Win.Spread.CellType.BarCode.BarSize("32.014mm", "9.26mm");
            barCodeCellType2.Type = new FarPoint.Win.Spread.CellType.BarCode.QRCode("");
            this.fpSpread1_Sheet1.Cells.Get(12, 2).CellType = barCodeCellType2;
            this.fpSpread1_Sheet1.Cells.Get(12, 2).Value = "12345";

            this.fpSpread1_Sheet1.Rows.Get(12).Height = 67F;

            #endregion

            #region ColorPickerCellType
            FarPoint.Win.Spread.CellType.ColorPickerCellType colorPickerCellType1 = new FarPoint.Win.Spread.CellType.ColorPickerCellType();
            FarPoint.Win.Spread.CellType.ColorPickerCellType colorPickerCellType2 = new FarPoint.Win.Spread.CellType.ColorPickerCellType();
            FarPoint.Win.Spread.CellType.TextCellType textCellType16 = new FarPoint.Win.Spread.CellType.TextCellType();
            this.fpSpread1_Sheet1.Cells.Get(13, 0).CellType = textCellType15;
            this.fpSpread1_Sheet1.Cells.Get(13, 0).Value = "颜色选取器型";
            colorPickerCellType1.AllowFullOpen = true;
            colorPickerCellType1.AnyColor = false;
            colorPickerCellType1.Caption = "选择颜色...";
            colorPickerCellType1.CustomColors = null;
            colorPickerCellType1.DropDown = false;
            colorPickerCellType1.FullOpen = false;
            colorPickerCellType1.SolidColorOnly = false;
            colorPickerCellType1.Style = FarPoint.Win.Spread.CellType.ColorPickerStyle.BoxedWithText;
            colorPickerCellType1.UnknownText = "";
            colorPickerCellType1.UnknownTextStyle = FarPoint.Win.Spread.CellType.UnknownTextStyle.Blank;
            this.fpSpread1_Sheet1.Cells.Get(13, 1).CellType = colorPickerCellType1;
            this.fpSpread1_Sheet1.Cells.Get(1, 1).VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Center;

            colorPickerCellType2.AllowFullOpen = true;
            colorPickerCellType2.AnyColor = false;
            colorPickerCellType2.Caption = "下拉";
            colorPickerCellType2.CustomColors = null;
            colorPickerCellType2.DropDown = true;
            colorPickerCellType2.FullOpen = false;
            colorPickerCellType2.SolidColorOnly = false;
            colorPickerCellType2.Style = FarPoint.Win.Spread.CellType.ColorPickerStyle.BoxedWithText;
            colorPickerCellType2.UnknownText = "";
            colorPickerCellType2.UnknownTextStyle = FarPoint.Win.Spread.CellType.UnknownTextStyle.Blank;
            this.fpSpread1_Sheet1.Cells.Get(13, 2).CellType = colorPickerCellType2;
            this.fpSpread1_Sheet1.Cells.Get(13, 2).Value = System.Drawing.SystemColors.Window;
            this.fpSpread1_Sheet1.Cells.Get(13, 2).VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Center;

            #endregion

            #region ImageCellType
            FarPoint.Win.Spread.CellType.ImageCellType imageCellType1 = new ImageCellType();
            FarPoint.Win.Spread.CellType.ImageCellType imageCellType2 = new ImageCellType();
            FarPoint.Win.Spread.CellType.TextCellType textCellType21 = new TextCellType();
            
            this.fpSpread1_Sheet1.Cells.Get(14, 0).CellType = textCellType21;
            this.fpSpread1_Sheet1.Cells.Get(14, 0).Value = "图象型";
            this.fpSpread1_Sheet1.Cells.Get(14, 1).CellType = imageCellType1;
            this.fpSpread1_Sheet1.Cells.Get(14, 2).CellType = imageCellType2;

            string defaultCommonPath2= System.IO.Path.Combine(Application.StartupPath, "..\\..\\Resources\\");// default XML path
            string commonPath5= defaultCommonPath2;
            Microsoft.Win32.RegistryKey commonKey2 = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey("FarPoint.Win.Spread\\Resources");
            if (commonKey2 != null)
            {
                object commonPathObj = commonKey.GetValue("v52005", defaultCommonPath);
                commonPath2 = commonPathObj is string ? (string)commonPathObj : defaultCommonPath;
            }
            string image8 = System.IO.Path.Combine(commonPath5, "Grapecity+powertools_bg.png");
            string image9 = System.IO.Path.Combine(commonPath5, "Spread中文版.png");
            System.Drawing.Image image10 = global::Demo.Properties.Resources.Grapecity_powertools_bg;
            System.Drawing.Image image11 = global::Demo.Properties.Resources.Spread中文版;
            fpSpread1.Sheets[0].Cells[14, 1].Value = image10;
            fpSpread1.Sheets[0].Cells[14, 2].Value = image11;
            fpSpread1_Sheet1.Rows[14].Height = 100F;

            #endregion

            #region MaskCellType
            FarPoint.Win.Spread.CellType.MaskCellType maskCellType1 = new FarPoint.Win.Spread.CellType.MaskCellType();
            FarPoint.Win.Spread.CellType.MaskCellType maskCellType2 = new FarPoint.Win.Spread.CellType.MaskCellType();
            FarPoint.Win.Spread.CellType.TextCellType textCellType17 = new FarPoint.Win.Spread.CellType.TextCellType();
            this.fpSpread1_Sheet1.Cells.Get(15, 0).CellType = textCellType17;
            this.fpSpread1_Sheet1.Cells.Get(15, 0).Value = "掩码单元格型";
            maskCellType1.Mask = "(###) ###-####";
            this.fpSpread1_Sheet1.Cells.Get(15, 1).CellType = maskCellType1;
            this.fpSpread1_Sheet1.Cells.Get(15, 1).Value = "1234567890";

            maskCellType2.CustomMaskCharacters = new string[] {
        "aAeEiIoOuU13579"};
            maskCellType2.Mask = "000000";
            this.fpSpread1_Sheet1.Cells.Get(15, 2).Value = "A1u39I";
            this.fpSpread1_Sheet1.Cells.Get(15, 2).CellType = maskCellType2;
            #endregion

            #region ProcessCellType
            System.Globalization.CultureInfo cultureInfo1 = new System.Globalization.CultureInfo("en-US", false);
            FarPoint.Win.Spread.CellType.ProgressCellType progressCellType1 = new FarPoint.Win.Spread.CellType.ProgressCellType();
            FarPoint.Win.Spread.CellType.ProgressCellType progressCellType2 = new FarPoint.Win.Spread.CellType.ProgressCellType();
            FarPoint.Win.Spread.CellType.TextCellType textCellType18 = new FarPoint.Win.Spread.CellType.TextCellType();
            this.fpSpread1_Sheet1.Cells.Get(16, 0).CellType = textCellType18;
            this.fpSpread1_Sheet1.Cells.Get(16, 0).Value = "进度条型";

            this.fpSpread1_Sheet1.Cells.Get(16, 1).CellType = progressCellType1;
            this.fpSpread1_Sheet1.Cells.Get(16, 1).ParseFormatInfo = ((System.Globalization.NumberFormatInfo)(cultureInfo.NumberFormat.Clone()));
            //((System.Globalization.NumberFormatInfo)(this.fpSpread1_Sheet1.Cells.Get(1, 1).ParseFormatInfo)).NumberDecimalDigits = 0;
            //((System.Globalization.NumberFormatInfo)(this.fpSpread1_Sheet1.Cells.Get(1, 1).ParseFormatInfo)).NumberGroupSizes = new int[] {
            //0};
            this.fpSpread1_Sheet1.Cells.Get(16, 1).ParseFormatString = "n";
            this.fpSpread1_Sheet1.Cells.Get(16, 1).Value = 50;

            progressCellType2.FillColor = System.Drawing.Color.Blue;
            progressCellType2.FillColor2 = System.Drawing.Color.Cyan;
            progressCellType2.FillTextColor = System.Drawing.Color.Black;
            progressCellType2.Orientation = FarPoint.Win.ProgressOrientation.BottomToTop;
            progressCellType2.TextStyle = FarPoint.Win.ProgressTextStyle.Value;
            this.fpSpread1_Sheet1.Cells.Get(16, 2).CellType = progressCellType2;
            this.fpSpread1_Sheet1.Cells.Get(16, 2).ParseFormatInfo = ((System.Globalization.NumberFormatInfo)(cultureInfo.NumberFormat.Clone()));
            ((System.Globalization.NumberFormatInfo)(this.fpSpread1_Sheet1.Cells.Get(16, 2).ParseFormatInfo)).NumberDecimalDigits = 0;
            ((System.Globalization.NumberFormatInfo)(this.fpSpread1_Sheet1.Cells.Get(16, 2).ParseFormatInfo)).NumberGroupSizes = new int[] {
        0};
            this.fpSpread1_Sheet1.Cells.Get(16, 2).ParseFormatString = "n";
            this.fpSpread1_Sheet1.Cells.Get(16, 2).Value = 33;
            this.fpSpread1_Sheet1.Cells.Get(16, 2).VisualStyles = FarPoint.Win.VisualStyles.Off;
            this.fpSpread1_Sheet1.Rows.Get(16).Height = 70F;
            #endregion

            #region SliderCellType
            FarPoint.Win.Spread.CellType.SliderCellType sliderCellType1 = new FarPoint.Win.Spread.CellType.SliderCellType();
            FarPoint.Win.Spread.CellType.SliderCellType sliderCellType2 = new FarPoint.Win.Spread.CellType.SliderCellType();
            FarPoint.Win.Spread.CellType.TextCellType textCellType19 = new FarPoint.Win.Spread.CellType.TextCellType();
            this.fpSpread1_Sheet1.Cells.Get(17, 0).CellType = textCellType19;
            this.fpSpread1_Sheet1.Cells.Get(17, 0).Value = "滑块型";
            sliderCellType1.ChangeOnFocus = true;
            sliderCellType1.KnobColor = System.Drawing.Color.LightSkyBlue;
            sliderCellType1.Maximum = 10;
            sliderCellType1.TickColor = System.Drawing.Color.DarkGray;
            sliderCellType1.TickSpacing = 10;
            sliderCellType1.TrackColor = System.Drawing.SystemColors.ScrollBar;
            this.fpSpread1_Sheet1.Cells.Get(17, 1).CellType = sliderCellType1;
            this.fpSpread1_Sheet1.Cells.Get(17, 1).Value = 0;
            this.fpSpread1_Sheet1.Cells.Get(17, 1).VisualStyles = FarPoint.Win.VisualStyles.Off;

            sliderCellType2.KnobColor = System.Drawing.Color.DarkOrange;
            sliderCellType2.Orientation = FarPoint.Win.SliderOrientation.VerticalBottomToTop;
            sliderCellType2.TickColor = System.Drawing.Color.Black;
            sliderCellType2.TrackColor = System.Drawing.Color.DarkGoldenrod;
            sliderCellType2.ChangeOnFocus = true;
            string defaultCommonPath1 = System.IO.Path.Combine(Application.StartupPath, "..\\..\\Resources\\");// default XML path
            string commonPath4 = defaultCommonPath;

            Microsoft.Win32.RegistryKey commonKey1 = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey("FarPoint.Win.Spread\\Resources");
            if (commonKey != null)
            {
                object commonPathObj = commonKey.GetValue("v52005", defaultCommonPath);
                commonPath1 = commonPathObj is string ? (string)commonPathObj : defaultCommonPath;
            }

            string image = System.IO.Path.Combine(System.IO.Path.Combine(commonPath4, "CellTypes"), "Leaf.bmp");
            sliderCellType2.BackgroundImage = new FarPoint.Win.Picture(global::Demo.Properties.Resources.Leaf, RenderStyle.StretchAndScale, Color.Empty, FarPoint.Win.HorizontalAlignment.Center, FarPoint.Win.VerticalAlignment.Center);
            this.fpSpread1_Sheet1.Cells.Get(17, 2).CellType = sliderCellType2;
            //this.fpSpread1_Sheet1.Cells.Get(3, 3).RowSpan = 5;
            this.fpSpread1_Sheet1.Cells.Get(17, 2).Value = 0;
            this.fpSpread1_Sheet1.Cells.Get(17, 2).VisualStyles = FarPoint.Win.VisualStyles.Off;
            this.fpSpread1_Sheet1.Rows.Get(17).Height = 70F;
            #endregion

            #region RichTextCellType

            FarPoint.Win.Spread.CellType.RichTextCellType richTextCellType1 = new FarPoint.Win.Spread.CellType.RichTextCellType();
            FarPoint.Win.Spread.CellType.RichTextCellType richTextCellType2 = new FarPoint.Win.Spread.CellType.RichTextCellType();
            FarPoint.Win.Spread.CellType.TextCellType textCellType20 = new FarPoint.Win.Spread.CellType.TextCellType();
            this.fpSpread1_Sheet1.Cells.Get(18, 0).CellType = textCellType20;
            this.fpSpread1_Sheet1.Cells.Get(18, 0).Value = "富文本型";
            richTextCellType1.WordWrap = true;
            this.fpSpread1_Sheet1.Cells.Get(18, 1).CellType = richTextCellType1;
            this.fpSpread1_Sheet1.Cells.Get(18, 1).Value = "在编辑模式时右键单击加载 RTF 文件或者使用上下文菜单格式化数据!";
            richTextCellType2.MaxLength = 500;
            richTextCellType2.Multiline = true;
            richTextCellType2.WordWrap = true;
            this.fpSpread1_Sheet1.Cells.Get(18, 2).CellType = richTextCellType2;
          this.fpSpread1_Sheet1.Cells.Get(18, 2).Value = @"{\rtf1\ansi\ansicpg936\uc1\deff0{\fonttbl"+
                                                        "{\f0\fnil\fcharset134\fprq2 \'cb\'ce\'cc\'e5;}"+
                                                        "{\f1\fnil\fcharset1\fprq2 Arial;}"+
                                                        "{\f2\froman\fcharset134\fprq2 Batang;}"+
                                                        "{\f3\froman\fcharset0\fprq2 Times New Roman;}"+
                                                        "{\f4\froman\fcharset0\fprq2 Georgia;}"+
                                                        "{\f5\froman\fcharset0\fprq2 Garamond;}"+
                                                        "{\f6\froman\fcharset2\fprq2 Symbol;}}"+
                                                        @"{\colortbl;\red0\green0\blue0;\red255\green255\blue255;\red128\green128\blue128;\red255\green0\blue0;\red0\green0\blue128;\red0\green0\blue255;}"+
                                                        @"{\stylesheet{\s0\itap0\nowidctlpar\f0\fs24 [Normal];}{\*\cs10\additive Default Paragraph Font;}}"+
                                                        @"{\*\generator TX_RTF32 16.0.534.501;}"+
                                                        @"\deftab1134\paperw12240\paperh15840\margl1440\margt1440\margr1440\margb1440\widowctrl\formshade\sectd"+
                                                        @"\headery720\footery720\pgwsxn12240\pghsxn15840\marglsxn1800\margtsxn1440\margrsxn1800\margbsxn1440\pard\itap0\nowidctlpar\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\tx9360\tx10080\plain\f2\fs24"+
                                                        @"{\shp{\*\shpinst\shpleft0\shptop1234\shpright18915\shpbottom1440\shpfhdr0\shpbxpage\shpbxignore\shpbypage\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shplid1025{\sp{\sn shapeType}{\sv 202}}{\sp{\sn fFlipH}{\sv 0}}{\sp{\sn fFlipV}{\sv 0}}{\sp{\sn fLockAgainstSelect}{\sv 1}}{\sp{\sn wzName}{\sv \'5f\'74\'78\'5f\'69\'67\'6e\'6f\'72\'65}}{\sp{\sn dxTextLeft}{\sv 0}}{\sp{\sn dyTextTop}{\sv 0}}{\sp{\sn dxTextRight}{\sv 0}}{\sp{\sn dyTextBottom}{\sv 0}}{\sp{\sn fLine}{\sv 0}}{\sp{\sn dxWrapDistLeft}{\sv 0}}{\sp{\sn dxWrapDistRight}{\sv 0}}{\sp{\sn posrelv}{\sv 1}}{\sp{\sn posrelh}{\sv 1}}{\sp{\sn fLayoutInCell}{\sv 1}}"+
                                                        @"{\shptxt\pard\itap0\nowidctlpar\plain\f1\fs12\b\cf3\'54\'68\'69\'73\'20\'64\'6f\'63\'75\'6d\'65\'6e\'74\'20\'68\'61\'73\'20\'62\'65\'65\'6e\'20\'63\'72\'65\'61\'74\'65\'64\'20\'77\'69\'74\'68\'20\'54\'58\'20\'54\'65\'78\'74\'20\'43\'6f\'6e\'74\'72\'6f\'6c\'20\'54\'72\'69\'61\'6c\'20\'56\'65\'72\'73\'69\'6f\'6e\'20\'31\'36\'2e\'30\'2e\'4e\'45\'54\'20\'2d\'20\'59\'6f\'75\'20\'63\'61\'6e\'20\'75\'73\'65\'20\'74\'68\'69\'73\'20\'74\'72\'69\'61\'6c\'20\'76\'65\'72\'73\'69\'6f\'6e\'20\'66\'6f\'72\'20\'66\'75\'72\'74\'68\'65\'72\'20\'30\'20\'64\'61\'79\'73\'2e\par}}}\loch\f2\hich\f2{\uc2\u-29723\'b8\'c3\u31034\'ca\'be\u20363\'c0\'fd\u28436\'d1\'dd\u31034\'ca\'be\u22914\'c8\'e7\u20309\'ba\'ce\u20351\'ca\'b9\u29992\'d3\'c3}\plain\f3\fs24  \plain\f3\fs24\b 西安葡萄城控件 \plain\f4\fs28\cf4 Spread .NET \f3\fs24  \plain\f3\fs24\ul\cf5 RichTextCellType\plain\f3\fs24\cf5  \plain\f2\fs24\loch\f2\hich\f2{\uc2\u21152\'bc\'d3\u-28803\'d4\'d8}\plain\f3\fs24  \plain\f3\fs24\i\cf6 RTF\plain\f3\fs24  \plain\f2\fs24\loch\f2\hich\f2{\uc2\u25991\'ce\'c4\u20214\'bc\'fe}\plain\f3\fs24 ... ...\par}";
            this.fpSpread1_Sheet1.Columns.Get(1).Width = 290F;
            this.fpSpread1_Sheet1.Rows.Get(18).Height = 177F;
            #endregion
            fpSpread1_Sheet1.Columns[0].Width = fpSpread1_Sheet1.Columns[0].GetPreferredWidth();
            fpSpread1_Sheet1.Columns[1].Width = fpSpread1_Sheet1.Columns[1].GetPreferredWidth();
            fpSpread1_Sheet1.Columns[2].Width = fpSpread1_Sheet1.Columns[2].GetPreferredWidth();
            fpSpread1_Sheet1.Rows.Count = 20;

        }

        private void proTimer_Tick(object sender, EventArgs e)
        {
            Color c = Color.Empty;
            int value = Convert.ToInt32(this.fpSpread1_Sheet1.Cells[16, 2].Value);
            this.fpSpread1_Sheet1.Cells[16, 2].Value = value < 100 ? value + 5 : 0;
            if (value < 25)
                c = Color.LightGreen;
            else if (value < 50)
                c = Color.Gold;
            else if (value < 75)
                c = Color.LightBlue;
            else
                c = Color.LightPink;

            if (((ProgressCellType)this.fpSpread1_Sheet1.Cells[16, 2].CellType).FillColor != c)
                ((ProgressCellType)this.fpSpread1_Sheet1.Cells[16, 2].CellType).FillColor = c;

            this.fpSpread1_Sheet1.Cells[16, 1].Value = value < 100 ? value + 5 : 0;        
        }
    }
}
